const app = getApp();
Page({

  data: {
    applyList:[]
  },
  onShow() {
    let that = this;
    wx.request({
        url: app.rootUrl + '/getApplys',
        data: {userId: app.accountInfo().accountId},
        header: {
          'Content-Type': 'application/x-www-form-urlencoded',
        },
        method: 'POST',
        success: function (res) {
          that.setData({
            applyList: res.data.rows
          });
        }
      })
  },
  showFile(){
    wx.showToast({
        title: '请在电脑端操作文件',
        icon: 'none',
      })
  },
  giveupApply(e){
      let that = this
        const id= e.currentTarget.dataset['id'];
        wx.request({
            url: app.rootUrl + '/giveupApply',
            data: {applyId: id},
            header: {
            'Content-Type': 'application/x-www-form-urlencoded',
            },
            method: 'POST',
            success: function (res) {
                wx.showToast({
                    title: res.data.msg,
                    icon: 'none',
                  })
                  if(res.data.status === 0){
                      that.onShow()
                  }
            }
        })
  }
})